/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import vo.VOAdministrator;

/**
 *
 * @author santiagobaldrich
 */
@Entity
@Table(name = "Administrator")
@NamedQueries(
{
    @NamedQuery(name = "Administrator.findAll", query = "SELECT a FROM Administrator a"),
    @NamedQuery(name = "Administrator.findByIdAdministrator", query = "SELECT a FROM Administrator a WHERE a.idAdministrator = :idAdministrator"),
    @NamedQuery(name = "Administrator.findByHandle", query = "SELECT a FROM Administrator a WHERE a.handle = :handle"),
    @NamedQuery(name = "Administrator.findByFirstName", query = "SELECT a FROM Administrator a WHERE a.firstName = :firstName"),
    @NamedQuery(name = "Administrator.findByLastName", query = "SELECT a FROM Administrator a WHERE a.lastName = :lastName"),
    @NamedQuery(name = "Administrator.findByPassword", query = "SELECT a FROM Administrator a WHERE a.password = :password"),
    @NamedQuery(name = "Administrator.findByAddress", query = "SELECT a FROM Administrator a WHERE a.address = :address"),
    @NamedQuery(name = "Administrator.findByPhone", query = "SELECT a FROM Administrator a WHERE a.phone = :phone"),
    @NamedQuery(name = "Administrator.findByEmail", query = "SELECT a FROM Administrator a WHERE a.email = :email")
})
public class Administrator implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idAdministrator")
    private Integer idAdministrator;
    @Basic(optional = false)
    @Column(name = "handle")
    private String handle;
    @Basic(optional = false)
    @Column(name = "firstName")
    private String firstName;
    @Basic(optional = false)
    @Column(name = "lastName")
    private String lastName;
    @Basic(optional = false)
    @Column(name = "password")
    private String password;
    @Column(name = "address")
    private String address;
    @Column(name = "phone")
    private String phone;
    @Basic(optional = false)
    @Column(name = "email")
    private String email;

    public Administrator()
    {
    }

    public Administrator(Integer idAdministrator)
    {
        this.idAdministrator = idAdministrator;
    }

    public Administrator(Integer idAdministrator, String handle, String firstName, String lastName, String password, String email)
    {
        this.idAdministrator = idAdministrator;
        this.handle = handle;
        this.firstName = firstName;
        this.lastName = lastName;
        this.password = password;
        this.email = email;
    }

    public Integer getIdAdministrator()
    {
        return idAdministrator;
    }

    public void setIdAdministrator(Integer idAdministrator)
    {
        this.idAdministrator = idAdministrator;
    }

    public String getHandle()
    {
        return handle;
    }

    public void setHandle(String handle)
    {
        this.handle = handle;
    }

    public String getFirstName()
    {
        return firstName;
    }

    public void setFirstName(String firstName)
    {
        this.firstName = firstName;
    }

    public String getLastName()
    {
        return lastName;
    }

    public void setLastName(String lastName)
    {
        this.lastName = lastName;
    }

    public String getPassword()
    {
        return password;
    }

    public void setPassword(String password)
    {
        this.password = password;
    }

    public String getAddress()
    {
        return address;
    }

    public void setAddress(String address)
    {
        this.address = address;
    }

    public String getPhone()
    {
        return phone;
    }

    public void setPhone(String phone)
    {
        this.phone = phone;
    }

    public String getEmail()
    {
        return email;
    }

    public void setEmail(String email)
    {
        this.email = email;
    }

    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += (idAdministrator != null ? idAdministrator.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object)
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Administrator))
        {
            return false;
        }
        Administrator other = (Administrator) object;
        if ((this.idAdministrator == null && other.idAdministrator != null) || (this.idAdministrator != null && !this.idAdministrator.equals(other.idAdministrator)))
        {
            return false;
        }
        return true;
    }

    @Override
    public String toString()
    {
        return "entities.Administrator[idAdministrator=" + idAdministrator + "]";
    }

    public VOAdministrator getVO()
    {
        VOAdministrator vo = new VOAdministrator();
        vo.setAddress(address);
        vo.setEmail(email);
        vo.setFirstName(firstName);
        vo.setHandle(handle);
        vo.setIdAdministrator(idAdministrator);
        vo.setLastName(lastName);
        vo.setPassword(password);
        vo.setPhone(phone);
        return vo;
}

    public void setVOData(VOAdministrator vo)
    {
        setAddress(vo.getAddress());
        setEmail(vo.getEmail());
        setFirstName(vo.getFirstName());
        setLastName(vo.getLastName());
        setPassword(vo.getPassword());
        setPhone(vo.getPhone());
    }
}
